fix(AdornerLayer): remove dead _layoutDirty infrastructure (CS0414)#7
Merged
Merged
Conversation
Follow-up to f703b12. The previous PR removed the unsafe _layoutDirty gate from OnLayoutUpdated but kept the field and its surrounding plumbing (Subscribe/Unsubscribe/OnAdornedElementLayoutUpdated + _subscribedElements HashSet) to keep that diff minimal and reversible. CI builds with TreatWarningsAsErrors=true, so the now-unused field trips CS0414 ("The field 'AdornerLayer._layoutDirty' is assigned but its value is never used") and blocks the if.81 publish. This is the planned cleanup. Removes: - _layoutDirty field (read-eliminated by the prior commit) - _subscribedElements HashSet - OnAdornedElementLayoutUpdated handler - SubscribeToElementLayout / UnsubscribeFromElementLayout helpers - All call sites that armed _layoutDirty (Add/Remove/Update/SetAdornerZOrder) - Per-element LayoutUpdated subscription from Add/Remove Net behavior unchanged from f703b12 - the gate was already removed, so these write-only assignments and unread subscriptions had no observable effect. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-up cleanup for #6 (
f703b12ae) to unblock the if.81 nuget publish.The prior PR removed the unsafe
_layoutDirtygate fromOnLayoutUpdatedbut deliberately kept the surrounding plumbing — field, HashSet, subscribe/unsubscribe helpers, and per-elementLayoutUpdatedhandler — so the change diff was minimal and reversible. CI builds withTreatWarningsAsErrors=true, and the now write-only field trips:This is the planned cleanup. Removes:
private bool _layoutDirtyfieldprivate HashSet<UIElement> _subscribedElementsfieldOnAdornedElementLayoutUpdatedhandlerSubscribeToElementLayout/UnsubscribeFromElementLayouthelpers_layoutDirty(inAdd,Remove,Update,Update(UIElement),SetAdornerZOrder)LayoutUpdatedsubscription fromAdd/RemoveNet behavior
Unchanged from
f703b12ae. The gate was already removed there, so the write-only assignments and unread subscriptions had no observable effect — this just stops emitting them.Validation
build-pf-local.bat):0 Warning(s) 0 Error(s)build.ymlon merge →InitialForce.WPF 10.0.0-if.81🤖 Generated with Claude Code